﻿package org.hsl.haxe;
/**
 * A slot is an object used to notify a listener.
 */
interface ISlot<D> {
	/**
	 * Indicates whether the slot has been destroyed (true) or not (false).
	 */
	private var destroyed(default, null):Bool;
	/**
	 * Calls the slot to notify a listener.
	 * 
	 * This method possibly forwards the passed signal or part of the passed signal to the listener (depending on the type of
	 * slot.)
	 */
	public function call(signal:Signal<D>):Void;
	/**
	 * Destroys the slot: removes it from the slot list it is in.
	 */
	public function destroy():Void;
}
/**
 * A null object implementation of the ISlot interface.
 */
class NullSlot<D> implements ISlot<D> {
	private var destroyed(default, null):Bool;
	public function new():Void {
		destroyed = false;
	}
	public function call(signal:Signal<D>):Void {
	}
	public function destroy():Void {
		destroyed = true;
	}
}